package com.jcfriends.main.payment.dao;

import java.util.ArrayList;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.jcfriends.main.payment.pojo.Payment;
import com.jcfriends.main.payment.pojo.PaymentInfo;

@Repository
public class PaymentDaoImpl implements PaymentDao {

	@Autowired
	private SqlSessionTemplate sessionTemplate;
	
	public ArrayList<PaymentInfo> getPaymentList(PaymentInfo paymentInfo){
		
		return (ArrayList)sessionTemplate.selectList("PaymentMapper.getPaymentList", paymentInfo);
	}
	
	public PaymentInfo getPayment(PaymentInfo paymentInfo){
		return (PaymentInfo)sessionTemplate.selectOne("PaymentMapper.getPayment", paymentInfo);
	}
	
	public int putPayment(PaymentInfo paymentInfo){
		
		return sessionTemplate.update("PaymentMapper.putPayment", paymentInfo);
	}
	
	public int postPayment(PaymentInfo paymentInfo){
		return sessionTemplate.insert("PaymentMapper.postPayment", paymentInfo);
	}
	
	public int deletePayment(PaymentInfo paymentInfo){
		return sessionTemplate.delete("PaymentMapper.deletePayment", paymentInfo);
	}
}
